package testPureMvc {
	import testPureMvc.controller.AppStartCommand;

	import org.puremvc.as3.multicore.interfaces.IFacade;
	import org.puremvc.as3.multicore.patterns.facade.Facade;

	import flash.display.Sprite;

	/**
	 * @author Admin
	 */
	public class ApplicationFacade extends Facade implements IFacade 
	{
			
		public static const APP_START : String = "appStart";
		public static const MAIN_SCREEN_SHOW : String = "mainScreenShow";
		
		//public static const LOAD_XML : String = "loadXml";
		
		// Constructor
		public function ApplicationFacade(key : String, singleton : ApplicationFacadeSingleton) 
		{
			trace("ApplicationFacade init ...");
			super(key);
		}
		
		
		public static function getInstance(key:String) : ApplicationFacade
		{
			if (instanceMap[key] == null) 
			{
				instanceMap[key] = new ApplicationFacade(key, new ApplicationFacadeSingleton());
			}
			return instanceMap[key]as ApplicationFacade;
		}
		
		override protected function initializeController() : void
		{
			super.initializeController();
			
			// register ALL commands
			registerCommand(APP_START, AppStartCommand);
			//registerCommand(LOAD_XML, MyXMLList);
		}
		
		public function startApp(mc : Sprite) : void
		{
			sendNotification(APP_START, mc);
		}
		
		
		
	}
	
	
	

}


class ApplicationFacadeSingleton {}
